package com.example.springbootswagger.controller;

import com.example.springbootswagger.entity.RestMessage;
import com.example.springbootswagger.entity.UserInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Slf4j
@Api(tags = "登录模块")
public class SwaggerDemoController {

    @ApiOperation(value = "测试接口")
    @RequestMapping(value = "/ping", method = RequestMethod.GET)
    public String ping() {
        return "hello Word";
    }


    @ApiOperation(value = "登录接口")
    @RequestMapping(value = "/login", method = RequestMethod.GET)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "userName", value = "账户", required = true, dataType = "String"),
            @ApiImplicitParam(name = "password", value = "密码", required = true, dataType = "String")
    })

    public RestMessage login(UserInfo userInfo) {
        log.info("登录信息：{}" + userInfo);
        return RestMessage.success();
    }
}
